package com.easylinkin.linkappapi.grid.models.vo;

import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 日报详情VO
 *
 * @author kyj
 * @date 2024/5/21 16:12
 */
@ApiModel(description = "日报详情VO")
@Data
public class GridReportDayDetailCollectVO implements Serializable {

    /**
     * 日报id
     */
    @ApiModelProperty(value = "日报id", position = 1)
    private Long reportId;

    /**
     * 平台项目名称
     */
    @ApiModelProperty(value = "平台项目名称", position = 2)
    private String platformProjectName;

    /**
     * 提交时间
     */
    @ApiModelProperty(value = "提交时间", position = 3)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime submitTime;

    /**
     * 网格层级
     */
    @ApiModelProperty(value = "网格层级", position = 4)
    private String gridHierarchy;

    /**
     * 网格数量（个）
     */
    @ApiModelProperty(value = "网格数量（个）", position = 5)
    private Integer gridNum;

    /**
     * 当日作业人数（个）
     */
    @ApiModelProperty(value = "当日作业人数（个）", position = 6)
    private Integer workerNum;

    /**
     * 安全员应到数（人）
     */
    @ApiModelProperty(value = "安全员应到数（人）", position = 7)
    private Integer dueSafetyOfficerNum;

    /**
     * 安全员实到数（人）
     */
    @ApiModelProperty(value = "安全员实到数（人）", position = 8)
    private Integer actSafetyOfficerNum;

    /**
     * 当日共有作业班组（个）
     */
    @ApiModelProperty(value = "当日共有作业班组（个）", position = 9)
    private Integer operationTeamNum;

    /**
     * 开展班前喊话（人）
     */
    @ApiModelProperty(value = "开展班前喊话（人）", position = 10)
    private Integer operationCallerNum;

    /**
     * 班前喊话涉及人数（人）
     */
    @ApiModelProperty(value = "班前喊话涉及人数（人）", position = 11)
    private Integer operationCallReferNum;

    /**
     * 当日排查一般隐患（起）
     */
    @ApiModelProperty(value = "当日排查一般隐患（起）", position = 12)
    private Integer checkGeneralHazard;

    /**
     * 一般隐患整改（起）
     */
    @ApiModelProperty(value = "一般隐患整改（起）", position = 13)
    private Integer changeGeneralHazard;

    /**
     * 当日排查重大隐患（起）
     */
    @ApiModelProperty(value = "当日排查重大隐患（起）", position = 14)
    private Integer checkGreatHazard;

    /**
     * 重大隐患整改（起）
     */
    @ApiModelProperty(value = "重大隐患整改（起）", position = 15)
    private Integer changeGreatHazard;

    /**
     * 个人举报隐患（项）
     */
    @ApiModelProperty(value = "个人举报隐患（项）", position = 16)
    private Integer personageReportHazard;

    /**
     * 违规问题罚款（元）
     */
    @ApiModelProperty(value = "违规问题罚款（元）", position = 17)
    private BigDecimal penaltyAmount;

    /**
     * 当日整改投入（万元）
     */
    @ApiModelProperty(value = "当日整改投入（万元）", position = 18)
    private BigDecimal changeInvestmentAmount;

    /**
     * 当日奖励个人（元）
     */
    @ApiModelProperty(value = "当日奖励个人（元）", position = 19)
    private BigDecimal rewardIndividualsAmount;

    /**
     * 当日突发事件情况
     */
    @ApiModelProperty(value = "当日突发事件情况", position = 20)
    private List<GridReportDayEmergencySituationVO> emergencySituationList;


    /**
     * 汇总
     *
     * @param vo
     * @author kyj
     * @date 2024/5/21 17:27
     */
    public void collect(GridReportDayDetailInfoVO vo) {
        this.gridHierarchy = StrUtil.isNotBlank(gridHierarchy) ? gridHierarchy : vo.getGridHierarchy();
        this.gridNum = ObjectUtil.isNotNull(gridNum) ? gridNum : vo.getGridNum();
        this.workerNum = NumberUtil.add(workerNum, vo.getWorkerNum()).intValue();
        this.dueSafetyOfficerNum = NumberUtil.add(dueSafetyOfficerNum, vo.getDueSafetyOfficerNum()).intValue();
        this.actSafetyOfficerNum = NumberUtil.add(actSafetyOfficerNum, vo.getActSafetyOfficerNum()).intValue();
        this.operationTeamNum = NumberUtil.add(operationTeamNum, vo.getOperationTeamNum()).intValue();
        this.operationCallerNum = NumberUtil.add(operationCallerNum, vo.getOperationCallerNum()).intValue();
        this.operationCallReferNum = NumberUtil.add(operationCallReferNum, vo.getOperationCallReferNum()).intValue();
        this.checkGeneralHazard = NumberUtil.add(checkGeneralHazard, vo.getCheckGeneralHazard()).intValue();
        this.changeGeneralHazard = NumberUtil.add(changeGeneralHazard, vo.getChangeGeneralHazard()).intValue();
        this.checkGreatHazard = NumberUtil.add(checkGreatHazard, vo.getCheckGreatHazard()).intValue();
        this.changeGreatHazard = NumberUtil.add(changeGreatHazard, vo.getChangeGreatHazard()).intValue();
        this.personageReportHazard = NumberUtil.add(personageReportHazard, vo.getPersonageReportHazard()).intValue();
        this.penaltyAmount = NumberUtil.add(penaltyAmount, vo.getPenaltyAmount());
        this.changeInvestmentAmount = NumberUtil.add(changeInvestmentAmount, vo.getChangeInvestmentAmount());
        this.rewardIndividualsAmount = NumberUtil.add(rewardIndividualsAmount, vo.getRewardIndividualsAmount());
    }
}
